import request from '@/utils/request'

/**
 * 查询用户
 * @param pageNum 页数
 * @param pageSize 每页数量
 * @param user 模糊查询
 * @returns {*}
 */
export function queryUser(pageNum, pageSize,user){
  return request({
    url: `/user/queryUser/${pageNum}/${pageSize}`,
    method: 'post',
    data: user
  })
}

/**
 * 根据ID删除用户
 * @returns {*}
 * @param userId
 */
export function deleteUser(userId){
  return request({
    url: `/user/deleteUserByUserId`,
    method: 'delete',
    params: {userId:userId}
  })
}

/**
 * 修改前根据ID查询用户
 * @param userId
 * @returns {*}
 */
export function queryUserByUserId(userId) {
  return request({
    url: `/user/queryUserByUserId`,
    method: 'get',
    params: {userId: userId}
  })
}

/**
 * 查询角色
 * @returns {AxiosPromise}
 */
export function queryRole() {
  return request({
    url: `/user/queryRole`,
    method: 'get',
  })
}

/**
 * 查询组织和部门
 * @returns {AxiosPromise}
 */
export function queryOrganization() {
  return request({
    url: `/user/queryOrganization`,
    method: 'get',
  })
}

/**
 * 根据ID修改用户
 * @param user
 * @returns {AxiosPromise}
 */
export function updateUser(user) {
  return request({
    url: `/user/updateUser`,
    method: 'put',
    data: user
  })
}

/**
 * 新增用户
 * @param user
 * @returns {*}
 */
export function addUser(user) {
  return request({
    url: `/user/addUser`,
    method: 'post',
    data: user
  })
}

